Skip to content

Replace generic Exception with sealed ApiException hierarchy#20

Merged
dadachi merged 1 commit intomainfrom
replace_generic_exception_with_sealed_api_exception
Mar 28, 2026
Merged

Replace generic Exception with sealed ApiException hierarchy#20
dadachi merged 1 commit intomainfrom
replace_generic_exception_with_sealed_api_exception

Conversation

@dadachi
Copy link
Copy Markdown
Contributor

@dadachi dadachi commented Mar 27, 2026

Summary

  • Added ApiException sealed class with ApiError and UnprocessableError subtypes in network/ApiException.kt
  • Updated ApiResponseExtensions.throwApiError() to throw typed exceptions instead of generic Exception
  • Updated LoginRepositoryImpl.logout() (the only remaining manual throw site)
  • Updated tests to assert specific ApiException types and fields

Test plan

  • ./gradlew testDebugUnitTest --tests "...ApiResponseExtensionsTest" — all pass
  • Verified typed exception fields (rawMessage, code, apiMessage) are asserted in tests

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dadachi dadachi merged commit 980e434 into main Mar 28, 2026
1 check passed
@dadachi dadachi deleted the replace_generic_exception_with_sealed_api_exception branch March 28, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant